3.979 \(\int (1-x)^n x^2 (1+x)^{-n} \, dx\)

Optimal. Leaf size=94 \[ -\frac {2^{-n} \left (2 n^2+1\right ) (1-x)^{n+1} \, _2F_1\left (n,n+1;n+2;\frac {1-x}{2}\right )}{3 (n+1)}+\frac {1}{3} n (1-x)^{n+1} (x+1)^{1-n}-\frac {1}{3} x (1-x)^{n+1} (x+1)^{1-n} \]

[Out]

1/3*n*(1-x)^(1+n)*(1+x)^(1-n)-1/3*(1-x)^(1+n)*x*(1+x)^(1-n)-1/3*(2*n^2+1)*(1-x)^(1+n)*hypergeom([n, 1+n],[2+n]
,1/2-1/2*x)/(2^n)/(1+n)

________________________________________________________________________________________

Rubi [A]  time = 0.03, antiderivative size = 94, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, integrand size = 18, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.167, Rules used = {90, 80, 69} \[ -\frac {2^{-n} \left (2 n^2+1\right ) (1-x)^{n+1} \, _2F_1\left (n,n+1;n+2;\frac {1-x}{2}\right )}{3 (n+1)}+\frac {1}{3} n (1-x)^{n+1} (x+1)^{1-n}-\frac {1}{3} x (1-x)^{n+1} (x+1)^{1-n} \]

Antiderivative was successfully verified.

[In]

Int[((1 - x)^n*x^2)/(1 + x)^n,x]

[Out]

(n*(1 - x)^(1 + n)*(1 + x)^(1 - n))/3 - ((1 - x)^(1 + n)*x*(1 + x)^(1 - n))/3 - ((1 + 2*n^2)*(1 - x)^(1 + n)*H
ypergeometric2F1[n, 1 + n, 2 + n, (1 - x)/2])/(3*2^n*(1 + n))

Rule 69

Int[((a_) + (b_.)*(x_))^(m_)*((c_) + (d_.)*(x_))^(n_), x_Symbol] :> Simp[((a + b*x)^(m + 1)*Hypergeometric2F1[
-n, m + 1, m + 2, -((d*(a + b*x))/(b*c - a*d))])/(b*(m + 1)*(b/(b*c - a*d))^n), x] /; FreeQ[{a, b, c, d, m, n}
, x] && NeQ[b*c - a*d, 0] &&  !IntegerQ[m] &&  !IntegerQ[n] && GtQ[b/(b*c - a*d), 0] && (RationalQ[m] ||  !(Ra
tionalQ[n] && GtQ[-(d/(b*c - a*d)), 0]))

Rule 80

Int[((a_.) + (b_.)*(x_))*((c_.) + (d_.)*(x_))^(n_.)*((e_.) + (f_.)*(x_))^(p_.), x_Symbol] :> Simp[(b*(c + d*x)
^(n + 1)*(e + f*x)^(p + 1))/(d*f*(n + p + 2)), x] + Dist[(a*d*f*(n + p + 2) - b*(d*e*(n + 1) + c*f*(p + 1)))/(
d*f*(n + p + 2)), Int[(c + d*x)^n*(e + f*x)^p, x], x] /; FreeQ[{a, b, c, d, e, f, n, p}, x] && NeQ[n + p + 2,
0]

Rule 90

Int[((a_.) + (b_.)*(x_))^2*((c_.) + (d_.)*(x_))^(n_.)*((e_.) + (f_.)*(x_))^(p_.), x_Symbol] :> Simp[(b*(a + b*
x)*(c + d*x)^(n + 1)*(e + f*x)^(p + 1))/(d*f*(n + p + 3)), x] + Dist[1/(d*f*(n + p + 3)), Int[(c + d*x)^n*(e +
 f*x)^p*Simp[a^2*d*f*(n + p + 3) - b*(b*c*e + a*(d*e*(n + 1) + c*f*(p + 1))) + b*(a*d*f*(n + p + 4) - b*(d*e*(
n + 2) + c*f*(p + 2)))*x, x], x], x] /; FreeQ[{a, b, c, d, e, f, n, p}, x] && NeQ[n + p + 3, 0]

Rubi steps

\begin {align*} \int (1-x)^n x^2 (1+x)^{-n} \, dx &=-\frac {1}{3} (1-x)^{1+n} x (1+x)^{1-n}-\frac {1}{3} \int (1-x)^n (1+x)^{-n} (-1+2 n x) \, dx\\ &=\frac {1}{3} n (1-x)^{1+n} (1+x)^{1-n}-\frac {1}{3} (1-x)^{1+n} x (1+x)^{1-n}-\frac {1}{3} \left (-1-2 n^2\right ) \int (1-x)^n (1+x)^{-n} \, dx\\ &=\frac {1}{3} n (1-x)^{1+n} (1+x)^{1-n}-\frac {1}{3} (1-x)^{1+n} x (1+x)^{1-n}-\frac {2^{-n} \left (1+2 n^2\right ) (1-x)^{1+n} \, _2F_1\left (n,1+n;2+n;\frac {1-x}{2}\right )}{3 (1+n)}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]  time = 0.04, size = 76, normalized size = 0.81 \[ -\frac {2^{-n} (1-x)^{n+1} (x+1)^{-n} \left (\left (2 n^2+1\right ) (x+1)^n \, _2F_1\left (n,n+1;n+2;\frac {1-x}{2}\right )+2^n (n+1) (x+1) (x-n)\right )}{3 (n+1)} \]

Antiderivative was successfully verified.

[In]

Integrate[((1 - x)^n*x^2)/(1 + x)^n,x]

[Out]

-1/3*((1 - x)^(1 + n)*(2^n*(1 + n)*(1 + x)*(-n + x) + (1 + 2*n^2)*(1 + x)^n*Hypergeometric2F1[n, 1 + n, 2 + n,
 (1 - x)/2]))/(2^n*(1 + n)*(1 + x)^n)

________________________________________________________________________________________

fricas [F]  time = 0.88, size = 0, normalized size = 0.00 \[ {\rm integral}\left (\frac {x^{2} {\left (-x + 1\right )}^{n}}{{\left (x + 1\right )}^{n}}, x\right ) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((1-x)^n*x^2/((1+x)^n),x, algorithm="fricas")

[Out]

integral(x^2*(-x + 1)^n/(x + 1)^n, x)

________________________________________________________________________________________

giac [F]  time = 0.00, size = 0, normalized size = 0.00 \[ \int \frac {x^{2} {\left (-x + 1\right )}^{n}}{{\left (x + 1\right )}^{n}}\,{d x} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((1-x)^n*x^2/((1+x)^n),x, algorithm="giac")

[Out]

integrate(x^2*(-x + 1)^n/(x + 1)^n, x)

________________________________________________________________________________________

maple [F]  time = 0.14, size = 0, normalized size = 0.00 \[ \int x^{2} \left (-x +1\right )^{n} \left (x +1\right )^{-n}\, dx \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((-x+1)^n*x^2/((x+1)^n),x)

[Out]

int((-x+1)^n*x^2/((x+1)^n),x)

________________________________________________________________________________________

maxima [F]  time = 0.00, size = 0, normalized size = 0.00 \[ \int \frac {x^{2} {\left (-x + 1\right )}^{n}}{{\left (x + 1\right )}^{n}}\,{d x} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((1-x)^n*x^2/((1+x)^n),x, algorithm="maxima")

[Out]

integrate(x^2*(-x + 1)^n/(x + 1)^n, x)

________________________________________________________________________________________

mupad [F]  time = 0.00, size = -1, normalized size = -0.01 \[ \int \frac {x^2\,{\left (1-x\right )}^n}{{\left (x+1\right )}^n} \,d x \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((x^2*(1 - x)^n)/(x + 1)^n,x)

[Out]

int((x^2*(1 - x)^n)/(x + 1)^n, x)

________________________________________________________________________________________

sympy [F]  time = 0.00, size = 0, normalized size = 0.00 \[ \int x^{2} \left (1 - x\right )^{n} \left (x + 1\right )^{- n}\, dx \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((1-x)**n*x**2/((1+x)**n),x)

[Out]

Integral(x**2*(1 - x)**n*(x + 1)**(-n), x)

________________________________________________________________________________________